Java Database Programming with JDBC Java Database Programming with JDBC
by Pratik Patel
Coriolis, The Coriolis Group
ISBN: 1576100561   Pub Date: 10/01/96
  

Previous Table of Contents Next


public interface ResultSetMetaData

This methods allows access to information about a query’s results, but not the results themselves. This object is created by the ResultSet.getMetaData method.

Methods

Method Name Additional Description
public abstract String getCatalogName(int column) throws SQLException Returns the name of the catalog hit by the query
public abstract int getColumnCount() throws SQLException Returns the number of columns in the resulting table
public abstract int getColumnDisplaySize(int column) throws SQLException Returns the specified column’s maximum size
public abstract String getColumnLabel(int column) throws SQLException Gets a label, if it exists, for the specified column in the result set
public abstract String getColumnName(int column) throws SQLException Gets a name for the specific column number in the resulting table
public abstract int getColumnType(int column) throws SQLException Returns a constant in the Type class that is the JDBC type of the specified column in the result set
public abstract String getColumnTypeName(int column) throws SQLException Gets the name of the type of the specified column in the result set
public abstract int getPrecision(int column) throws SQLException Returns the precision of the data in the specified column, if applicable
public abstract int getScale(int column) throws SQLException Returns the scale of the data in the specified column, if applicable
public abstract String getSchemaName(int column) throws SQLException Returns the name of the schema that was accessed in the query to produce the result set for the specific column
public abstract String getTableName(int column) throws SQLException Returns the name of the table from which the specified column in the result set came from
public abstract boolean isAutoIncrement (int column) throws SQLException Returns true if the specified column is automatically numbered
public abstract boolean isCaseSensitive (int column) throws SQLException Returns true if the specified column’s contents are case sensitive, if applicable
public abstract boolean isCurrency(int column) throws SQLException Returns true if the content of the specific column in the result set was a currency
public abstract boolean isDefinitelyWritable(int column) throws SQLException Returns true if a write operation in the specified column can be done for certain
public abstract int isNullable(int column) throws SQLException Returns true if the specified column accepts NULL entries
public abstract boolean isReadOnly(int column) throws SQLException Returns true if the specified column is read only
public abstract boolean isSearchable(int column) throws SQLException Returns true if the WHERE clause can be a part of the SQL query performed on the specified column
public abstract boolean isSigned(int column) throws SQLException Returns true if the data contained in the specified column in the result set is signed, if applicable
public abstract boolean isWritable(int column) throws SQLException Returns true if a write on the specified column is possible

Variables

Variable Name Additional Description
public final static int columnNoNulls NULL values not allowed
public final static int columnNullable NULL values allowed
public final static int columnNullableUnknown NULL values may or may not be allowed, uncertain

public interface Statement

This class is used to execute a SQL query against the database via the Connection object. The Connection.createStatement returns a Statement object. Methods in the Statement class produce ResultSet objects which are used to fetch the result of a query executed in this class.

Methods

Method Name Additional Description
public abstract void cancel() throws SQLException If a query is running in another thread, a foreign thread can cancel it by calling this method on the local Statement object’s instantiation
public abstract void clearWarnings() throws SQLException Clears the warnings for the Statement
public abstract void close() throws SQLException Closes the Statement and frees its associated resources, including any ResultSets
public abstract boolean execute(String sql) throws SQLException Executes the parameter sql, which is an SQL query; this method accounts for multiple ResultSets
public abstract ResultSet executeQuery(String sql) throws SQLException Executes a query that returns a ResultSet object (produces some results) using the sql parameter as the SQL query
public abstract int executeUpdate(String sql) throws SQLException Executes a query that does not produce a resulting table; the method returns the number of rows affected or 0 if no result is produced
public abstract int getMaxFieldSize() throws SQLException Returns the maximum amount of data returned for a resulting column; applies only to the following SQL datatypes: BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR
public abstract int getMaxRows() throws SQLException Returns the maximum number of rows a ResultSet can contain
public abstract boolean getMoreResults() throws SQLException Returns true if the next ResultSet of the query is present, and moves the ResultSet into the current result space
public abstract int getQueryTimeout() throws SQLException Returns the number of seconds that the JDBC driver will wait for a query to execute
public abstract ResultSet getResultSet() throws SQLException Returns a ResultSet object that is the current result of the query; only one of these is returned if only one ResultSet is the result of the query; if more ResultSets are present, the getMoreResults method is used to move to the next ResultSet
public abstract int getUpdateCount() throws SQLException Returns the update count; if the result is a ResultSet, -1 is returned
public abstract SQLWarning getWarnings() throws SQLException Returns the warnings encountered for the query of this Statement object
public abstract void setCursorName(String name) throws SQLException Sets the name of a cursor for future reference, and uses it in update statements
public abstract void setEscapeProcessing(boolean enable) throws SQLException Sets escape substitution processing
public abstract void setMaxFieldSize(int max) throws SQLException Sets the maximum amount of data that can be returned for a column of type BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR
public abstract void setMaxRows(int max) throws SQLException Sets the maximum number of rows that can be retrieved in a ResultSet
public abstract void setQueryTimeout(int seconds) throws SQLException Sets the time a driver will wait for a query to execute


Previous Table of Contents Next